import storage from '@/utils/storage'
const state = {
  roles: storage.getItem('rbac_roles'),
  permissions: storage.getItem('rbac_permissions'),
  systems: storage.getItem('rbac_systems'),
  menus: storage.getItem('rbac_menu')
}
const mutations = {
  SET_ROLE_DATA (state, payload) {
    state.roles = payload
  },
  SET_SYSTEM_DATA (state, payload) {
    state.systems = payload
  }
}
const actions = {
  setRoleData ({commit}, payload) {
    commit('SET_ROLE_DATA', payload)
  },
  setSystemData ({commit}, payload) {
    commit('SET_SYSTEM_DATA', payload)
  }
}
const getters = {
  roles: state => {
    return state.roles
  },
  permissions: state => {
    return state.permissions
  },
  systems: state => {
    return state.systems
  }
}
export default {
  state, mutations, actions, getters
}
